package com.springboot.demo.model.enums;

/**
 * Created by hwm on 2018/6/22.
 */
public enum GoodsTypeEnum {

    CODE0100("0100", "母婴生活护理"), CODE0700("0700", "专业保洁"), CODE0900("0900", "定期保洁");

    private String value;
    private String name;

    GoodsTypeEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public static GoodsTypeEnum getByValue(String value) {
        for (GoodsTypeEnum typeEnum : GoodsTypeEnum.values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum;
            }
        }

        return null;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

//    public static void main(String[] a){
//
//        String name = GoodsTypeEnum.CODE0100.getName();
//        String value = GoodsTypeEnum.CODE0100.getValue();
//        GoodsTypeEnum code0100 = GoodsTypeEnum.getByValue("0900");
//        System.out.println(name);
//        System.out.println(value);
//        System.out.println(code0100.getName());
//
//    }
}
